Python Essential Reference (4th Edition) by Beazley David M

Python Essential Reference (4th Edition) by Beazley David M

Author:Beazley, David M. [Beazley, David M.]
Language: eng
Format: mobi
Publisher: Addison-Wesley Professional
Published: 2009-06-28T16:00:00+00:00


Message Handling

Normally, messages are handled by the root logger. However, any Logger object can have special handlers added to it that receive and process log messages. This is done using these methods of a Logger instance log.

log.addHandler(handler)

Adds a Handler object to the logger.

log.removeHandler(handler)

Removes the Handler object handler from the logger.

The logging module has a variety of pre-built handlers for writing log messages to files, streams, system logs, and so forth. These are described in further detail in the next section. However, the following example shows how loggers and handlers are hooked together using these methods.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.